package com.axt.dbaudit.unitTest;

import java.util.List;

import com.axt.dbaudit.bean.cfg.IpGroupBean;
import com.axt.dbaudit.model.cfg.IpGroup;

/**
 * 
 * 测试添加IP分组
 *
 */

public class SoaIpGroupTest {
	void testAddIpGroup(){
	boolean	bRet = new IpGroupBean().addGroupName("cyh");

		if (bRet)
		{
			System.out.println("cyh！");
		}
		else
		{
			System.out.print("输出失败！！！");
		}
	}
	/**
	 * 测试添加客户端IP
	 */
	void testaddClientIp(){
		boolean	bRet = new IpGroupBean().addClientIp("添加计算机名", "000000000002", 0, "192.168.1.61", "ip别名");
		if (bRet)
		{
			System.out.print("au_comname::添加计算机名");
			System.out.print("au_mac::000000000002");
			System.out.print("user_id::0");
			System.out.print("au_IP::192.168.1.61");
		}
		else
		{
			System.out.print("输入失败！");
		}
	}
	/**
	 * 测试删除客户端分组
	 */
	void testdeleteGroupById(){
		boolean	bRet = new IpGroupBean().deleteGroupById(4);
		if(bRet)
		{
			System.out.print("user_id::0");
			System.out.print("au_id::4");
		}
		else
		{
			System.out.print("输入失败！");
		}
	}
	/**
	 * 测试删除客户端IP
	 */
	void testdeleteClientIpById(){
			boolean	bRet = new IpGroupBean().deleteClientIpById(704);
			if(bRet)
			{
				System.out.print("user_id::0");
				System.out.print("au_id::704");
			}
			else
			{
				System.out.print("输入失败！");
			}
	}
	/**
	 * 测试重名组
	 */
	void testmodifyGroupName(){
		boolean	bRet = new IpGroupBean().modifyGroupName("cyh", 172);
		if(bRet)
		{
			System.out.print("au_name::cyh");
			System.out.print("user_id::0");
			System.out.print("au_id::172");
		}
		else
		{
			System.out.print("输入失败！");
		}
	}
	/**
	 * 测试修改客户端分组
	 */
	void testmodifyClient(){
		boolean	bRet = new IpGroupBean().modifyClientIP("zhy", "111111111111","192.168.1.6", 402);
		if(bRet)
		{
			System.out.print("au_comname::zhy");
			System.out.print("au_mac::111111111111");
			System.out.print("user_id::0");
			System.out.print("au_ip::192.168.1.6");
			System.out.print("au_id::402");
		}
		else
		{
			System.out.print("输入失败！");
		}
	}

	/**
	 * 获取IP_group_item列表
	 */
	void testqueryIpGroupItem()
	{
		List<IpGroup> ipGroups = null;
		ipGroups = new IpGroupBean().queryIpGroupAndItem();
		if (ipGroups != null){
			System.out.println("获取IP_group_item分组成功！");
		}
	}
	public static void main(String[] args) throws Exception
	{
		new SoaIpGroupTest().testaddClientIp();
		new SoaIpGroupTest().testAddIpGroup();
		new SoaIpGroupTest().testdeleteClientIpById();
		new SoaIpGroupTest().testmodifyClient();
		new SoaIpGroupTest().testmodifyGroupName();
		new SoaIpGroupTest().testdeleteGroupById();
		new SoaIpGroupTest().testqueryIpGroupItem();
	}
}

